package com.zhong.gang.app.ui.main;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhong.gang.app.R;
import com.zhong.gang.applib.utils.TimeUtils;

public class MainAdapter extends BaseQuickAdapter<MainBean, BaseViewHolder> {
    public MainAdapter() {
        super(R.layout.item_main);
    }

    @Override
    protected void convert(BaseViewHolder helper, MainBean item) {
        helper.setText(R.id.car_num,"车牌号："+item.getCarNum());
        TextView status = helper.getView(R.id.status);
        status.setText(item.getDone() == 0?"未处理":"已处理");
        status.setBackgroundResource(item.getDone() == 1?R.drawable.bg_blue80_radius3:R.drawable.bg_rede9_radius3);
        helper.setText(R.id.time, TimeUtils.getTime3(item.getCreateTimestamp()));
        if (item.getType() == 1){
            helper.setText(R.id.type_tv,"外调货业");
        }else if (item.getType() == 2){
            helper.setText(R.id.type_tv,"驻厂接单");
        }else if (item.getType() == 3){
            helper.setText(R.id.type_tv,"到厂确认");
        }else if (item.getType() == 4){
            helper.setText(R.id.type_tv,"中转收货");
        }else if (item.getType() == 5){
            helper.setText(R.id.type_tv,"中转发货");
        }else {
            helper.setText(R.id.type_tv,"未知...");
        }
        helper.setText(R.id.order_num,item.getSn());
    }
}